<#import '/ftlLibrary/properteisVariable.ftl' as pv/>
<link href="assets/css/bootstrap-select.css" rel="stylesheet"/>
<link href="assets/css/front/listCommonStyle.css" rel="stylesheet"/>
<link href="assets/css/modify.css" rel="stylesheet"/>
<script src="assets/js/select2/select2.js"></script>
<style>
    .bootbox-close-button {
        width: 19px;
        height: 19px;
        border: none;
        cursor: pointer;
        -webkit-appearance: none;
        float: right;
        top: 4px;
        left: -5px;
        position: relative;
        background: #E9F5FF url("assets/img/nav-img/icon_close.png") no-repeat 0 0;
    }
    td, th {
        height: 34.29px !important;
    }

    .familyMemberDialog .modal-dialog {
        width: 50%;
    }

    input {
        height: 30px !important;
    }

    .editFormDiv label {
        margin: 0 auto !important;
    }

    .editFormDiv .control-label {
        text-align: right;
        line-height: 25px;
    }
    .labelBorderTable label{
        margin:0;
        padding:0;
    }
    .editFormDiv>div {
        min-height: 0px!important;
    }
</style>
<div class="row" style="margin-left: 0px!important;">
    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 margin-top-20" style="height: 34.29px;line-height: 34.29px;background-color: #eee;padding: 0px 10px;">
            <label>
                会员信息
            </label>
        </div>
    </div>
    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 labelBorderTable" style="margin-top: 15px">
        <label class="col-xs-4 text-align-center" style="border: 1px solid #ccc;border-bottom: none">
            <label class="col-xs-6" style="border-right: 1px solid #ccc;padding: 5px 0;">
                会员编号：
            </label>
            <label class="col-xs-6" style="padding: 5px 0">
                ${(viewStudentDetails.number???string(viewStudentDetails.number?html,"未设置"))!'未设置'}
            </label>
        </label>
        <label class="col-xs-4 text-align-center" style="border: 1px solid #ccc;border-left: none;border-bottom: none">
            <label class="col-xs-6" style="border-right: 1px solid #ccc;padding: 5px 0">
                客户姓名：
            </label>
            <label class="col-xs-6" style="padding: 5px 0">
                ${(viewStudentDetails.name???string(viewStudentDetails.name?html,"未设置"))!'未设置'}
            </label>
        </label>
        <label class="col-xs-4 text-align-center" style="border: 1px solid #ccc;border-left: none;border-bottom: none">
            <label class="col-xs-6" style="border-right: 1px solid #ccc;padding: 5px 0">
                会员性别：
            </label>
            <label class="col-xs-6" style="padding: 5px 0">
                ${(viewStudentDetails.sex???string(viewStudentDetails.sex?html,"未设置"))!'未设置'}
            </label>
        </label>

        <label class="col-xs-4 text-align-center" style="border: 1px solid #ccc;">
            <label class="col-xs-6" style="border-right: 1px solid #ccc;padding: 5px 0">
                联系电话：
            </label>
            <label class="col-xs-6" style="padding: 5px 0">
                ${(viewStudentDetails.contactPhone???string(viewStudentDetails.contactPhone?html,"未设置"))!'未设置'}
            </label>
        </label>
        <label class="col-xs-4 text-align-center" style="border: 1px solid #ccc;border-left: none">
            <label class="col-xs-6" style="border-right: 1px solid #ccc;padding: 5px 0">
                会员类型：
            </label>
            <label class="col-xs-6" style="padding: 5px 0">
                ${(viewStudentDetails.type???string(viewStudentDetails.type?html,"未设置"))!'未设置'}
            </label>
        </label>
        <label class="col-xs-4 text-align-center" style="border: 1px solid #ccc;border-left: none">
            <label class="col-xs-6" style="border-right: 1px solid #ccc;padding: 5px 0">
                所属顾问：
            </label>
            <label class="col-xs-6" style="padding: 5px 0">
                ${(viewStudentDetails.realName???string(viewStudentDetails.realName?html,"未设置"))!'未设置'}
            </label>
        </label>

        <label class="col-xs-4 text-align-center" style="border: 1px solid #ccc;border-top: none">
            <label class="col-xs-6" style="border-right: 1px solid #ccc;padding: 5px 0">
                缴费总额：
            </label>
            <label class="col-xs-6" style="padding: 5px 0">
                ${(viewStudentDetails.sumAmount???string(viewStudentDetails.sumAmount?html,"未设置"))!'未设置'}
            </label>
        </label>
        <label class="col-xs-4 text-align-center" style="border: 1px solid #ccc;border-left: none;border-top: none">
            <label class="col-xs-6" style="border-right: 1px solid #ccc;padding: 5px 0">
                退费总额：
            </label>
            <label class="col-xs-6" style="padding: 5px 0">
                ${(viewStudentDetails.refundAmout???string(viewStudentDetails.refundAmout?html,"未设置"))!'未设置'}
            </label>
        </label>
        <label class="col-xs-4 text-align-center" style="border: 1px solid #ccc;border-left: none;border-top: none">
            <label class="col-xs-6" style="border-right: 1px solid #ccc;padding: 5px 0">
                合计：
            </label>
            <label class="col-xs-6" style="padding: 5px 0">
                ${(viewStudentDetails.total???string(viewStudentDetails.total?html,"未设置"))!'未设置'}
            </label>
        </label>
    </div>
    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 margin-top-20" style="height: 34.29px;line-height: 34.29px;background-color: #eee;padding: 0px 10px;">
            <label>
                退费信息
            </label>
        </div>
    </div>
    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style="margin-top: 15px">
        <div class="widget flat radius-bordered" style="margin-top: 0;margin-bottom: 0px!important;box-shadow:0px 0px 10px rgba(122,161,184,0.3);!important;">
            <div class="widget-body no-padding">
                <div class="table-scrollable">
                    <!-- 数据表列信息列表 -->
                    <table class="table table-bordered dataTable">
                        <thead>
                        <tr>
                            <th title="费用类型">费用类型</th>
                            <th title="缴费总额">缴费总额</th>
                            <th title="退费总额">退费总额</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td>特殊退费</td>
                            <td>${(data.sumAmout???string(data.sumAmout ?html,"未设置"))!'未设置'}</td>
                            <td>${(data.returnAmout???string(data.returnAmout?html,"未设置"))!'未设置'}</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="refundDetails show">
            <div class="col-xs-6 col-sm-6" style="margin-top: 15px">
                <label>退款金额：</label>
                <label>${tssMemberReturnPremium.amout}</label>
            </div>
            <div class="col-xs-6 col-sm-6 " style="margin-top: 15px">
                <label>退款备注：</label>
                <label>${tssMemberReturnPremium.remark}</label>
            </div>
        </div>
        <div class="confirm hidden">
            <form>
                <input style="width: 80px" type="button" class="btn btn-blue" data-dismiss="modal" value="提交" refundStatus="5" stuId="${tssMemberReturnPremium.memberId}"
                       refundId="${tssMemberReturnPremium.id}" onclick="Approval(this)"/>
                <input style="width: 80px" type="button" class="btn btn-blue" data-dismiss="modal" value="删除" isDelete="1"  stuId="${tssMemberReturnPremium.memberId}"
                       refundId="${tssMemberReturnPremium.id}" onclick="Approval(this)"/>
            </form>
        </div>
    </div>

    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
        <div class="refundEdit hidden">
            <form class="editForm" action="${saveUrl}" method="post" responseType="JSON" role="form"
                  id="editForm_${serializeNum}"          data-bv-submitButtons="#editFormSubmitBtn_${serializeNum}"
                  data-bv-message="This value is not valid"
                  data-bv-feedbackicons-valid="glyphicon glyphicon-ok"
                  data-bv-feedbackicons-invalid="glyphicon glyphicon-remove"
                  data-bv-feedbackicons-validating="glyphicon glyphicon-refresh">

                <input type="hidden" class="modify" name="modify" value="${modify}">
                <input type="hidden" name="paymentId" value="${data.id}">
                <input type="hidden" name="stuId" value="${stuId}">
                <input type="hidden" name="packageId" value="${packageId}">
                <input type="hidden" name="refundType" value="${refundType}">
                <input type="hidden" name="paymentType" value="${data.paymentType}">
                <input type="hidden" class="type" name="type" value="${data.type}"/>
                <input type="hidden" class="surplusFormalAttendanceDay" name="surplusFormalAttendanceDay" value="${data.surplusFormalAttendanceDay}"/>
                <input type="hidden" class="surplusFormalClassHour" name="surplusFormalClassHour" value="${data.surplusFormalClassHour}"/>
                <input type="hidden" class="positiveConsumptionAttendanceDay" name="positiveConsumptionAttendanceDay" value="${data.positiveConsumptionAttendanceDay}"/>
                <input type="hidden" class="positiveConsumptionClassHour" name="positiveConsumptionClassHour" value="${data.positiveConsumptionClassHour}"/>
                <input type="hidden" class="originalUnitPrice" name="originalUnitPrice" value="${data.originalUnitPrice}"/>
                <input type="hidden" class="sumPrice" name="sumPrice" value="${data.sumPrice}"/>
                <div>
                    <div class="col-xm-12 col-sm-6 col-lg-12">
                        <div class="form-group">
                            <label for="classHour" class="col-sm-2 col-sm-offset-2 control-label no-padding-right">退课时数：</label>
                            <div class="col-sm-4">
                                <input data-bv-integer-message="The field is number" data-bv-message="The field is not valid"
                                       data-bv-integer="true" size="11" name="" id="classHour" alt="退课时数"  placeholder="退课时数"
                                       type="text" title="退课时数" class="form-control" value="${tssMemberReturnPremium.classHour}" onblur="refundAmount(this)"/>
                                <span class="text"></span>
                            </div>
                            <label for="classHour" class="col-sm-3 control-label no-padding-right">退课时数：
                                <#if data.type == 1>
                                    ${surplusFormalClassHour}
                                </#if>
                                <#if data.type == 2>
                                    ${surplusFormalAttendanceDay}
                                </#if>
                                课/次（不含赠课）</label>
                            <!--<label for="classHour" class="col-sm-3 control-label no-padding-right">退课时数：${surplusFormalClassHour}课/次（不含赠课）</label>-->
                        </div>
                    </div>
                    <div class="col-xm-12 col-sm-6 col-lg-12">
                        <div class="form-group">
                            <label for="amout" class="col-sm-2 col-sm-offset-2 control-label no-padding-right">退费金额：</label>
                            <div class="col-sm-4">
                                <input data-bv-integer-message="The field is number" data-bv-message="The field is not valid"
                                       data-bv-integer="true" size="11" name="" id="amout" alt="退费金额"  placeholder="退费金额"
                                       type="text" title="退费金额" class="form-control" value="${tssMemberReturnPremium.amout}"/>
                                <span class="text"></span>
                            </div>
                        </div>
                    </div>

                    <div class="col-xm-12 col-sm-6 col-lg-12">
                        <div class="form-group">
                            <label for="remark" class="col-sm-2 col-sm-offset-2 control-label no-padding-right">退费备注：</label>
                            <div class="col-sm-6">
                                <textarea class="form-control" name="" size="500" rows="2" style="resize:none" id="remark" value="${tssMemberReturnPremium.remark}">${tssMemberReturnPremium.remark}</textarea>
                                <!--<input data-bv-message="The field is not valid" size="500" name="remark" alt="备注" id="remark"-->
                                <!--placeholder="备注" type="text" title="备注" class="form-control"-->
                                <!--value="${editEntity.remark}"/>-->
                                <!--<span class="text"></span>-->
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-12 margin-top-20">
                        <div class="text-align-center">
                            <!--<button style="width: 80px;margin-right: 20px" type="submit" class="btn btn-blue" id="depositEditFormSubmitBtn_${serializeNum}">提交</button>
                            <input style="width: 80px" type="button" class="btn btn-blue" data-dismiss="modal" value="驳回" onclick="backView()"/>-->
                            <input style="width: 80px" type="button" class="btn btn-blue" data-dismiss="modal" value="提交" refundStatus="2"
                                   refundId="${tssMemberReturnPremium.id}" onclick="Approval(this)"/>
                            <input style="width: 80px" type="button" class="btn btn-blue" data-dismiss="modal" value="删除" isDelete="1"
                                   refundId="${tssMemberReturnPremium.id}" onclick="Approval(this)"/>
                        </div>
                    </div>
                </div>
            </form>
        </div>
        <div class="Approval show">
            <form class="editForm editFormDiv" action="${saveUrl}" method="post" responseType="JSON" role="form"
                  id="1editForm_${serializeNum}"          data-bv-submitButtons="#editFormSubmitBtn_${serializeNum}"
                  data-bv-message="This value is not valid"
                  data-bv-feedbackicons-valid="glyphicon glyphicon-ok"
                  data-bv-feedbackicons-invalid="glyphicon glyphicon-remove"
                  data-bv-feedbackicons-validating="glyphicon glyphicon-refresh">
                <input type="hidden" name="id" value="${tssMemberReturnPremium.id}">
                <input type="hidden" name="refundStatus" value="3">
                <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                    <div class="form-group">
                        <label for="approvalRemark" class="col-xs-2 control-label no-padding-right nopadding-left" style="max-width: 65px">批示内容：</label>
                        <div class="col-xs-10" style="padding-left: 5px!important;">
                            <textarea class="form-control" name="approvalRemark" size="500" rows="3" style="resize:none" id="approvalRemark" value="${tssMemberReturnPremium.approvalRemark}">${tssMemberReturnPremium.approvalRemark}</textarea>
                            <!--<input data-bv-message="The field is not valid" size="500" name="remark" alt="备注" id="remark"-->
                            <!--placeholder="备注" type="text" title="备注" class="form-control"-->
                            <!--value="${editEntity.remark}"/>-->
                            <!--<span class="text"></span>-->
                        </div>
                    </div>
                </div>
                <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style="margin-top: 15px">
                    <div class="text-align-center">
                        <!--<button style="width: 80px;margin-right: 20px" type="submit" class="btn btn-blue" id="1EditFormSubmitBtn_${serializeNum}">确定</button>-->
                        <input style="width: 80px" type="button" class="btn btn-blue" data-dismiss="modal" value="审批通过" refundStatus="3"
                               refundId="${tssMemberReturnPremium.id}" onclick="Approval(this)"/>
                        <input style="width: 80px" type="button" class="btn btn-blue" data-dismiss="modal" value="驳回" refundStatus="4"
                               refundId="${tssMemberReturnPremium.id}" onclick="Approval(this)"/>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 margin-top-20" style="height: 34.29px;line-height: 34.29px;background-color: #eee;padding: 0px 10px;">
            <label>
                操作信息
            </label>
        </div>
    </div>

    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style="margin-top: 15px">
        <div class="widget flat radius-bordered" style="margin-top: 0;box-shadow:0px 0px 10px rgba(122,161,184,0.3);">
            <div class="widget-body no-padding">
                <div class="table-scrollable" style="border: none;">
                    <div class="table-scrollable">
                        <!-- 数据表列信息列表 -->
                        <table class="table table-hover dataTable newtable">
                            <thead>
                            <tr>
                                <th title="操作人">操作人</th>
                                <th title="办理状态">办理状态</th>
                                <th title="办理意见">办理意见</th>
                                <th title="办理时间">办理时间</th>
                            </tr>
                            </thead>
                            <tbody>
                            <#if page_bean.list?size==0>
                                <tr>
                                    <td align="center">无数据</td>
                                </tr>
                            </#if>
                            <#list tssMemberReturnPremiumHistory as data>
                                <tr>
                                    <td>${(data.userName???string(data.userName?html,"未设置"))!'未设置'}</td>
                                    <td>${(data.refundStatus???string(data.refundStatus?html,"未设置"))!'未设置'}</td>
                                    <td>${(data.approvalRemark???string(data.approvalRemark?html,"未设置"))!'未设置'}</td>
                                    <td>${(data.updateTime???string(data.updateTime?html,"未设置"))!'未设置'}</td>
                                </tr>
                            </#list>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>


</div>
<script src="assets/js/validation/bootstrapValidator_init.js"></script>
<script>
    $(function () {
        var modify = $(".modify").val();
        if(modify == 1){
            $(".refundDetails").removeClass("show").addClass("hidden");
            $(".refundEdit").removeClass("hidden").addClass("show");
            $(".Approval").removeClass("show").addClass("hidden");
        }
        if(modify == 2){
            $(".confirm").removeClass("hidden").addClass("show");
            $(".Approval").removeClass("show").addClass("hidden");
        }
    });
    function prompt(that){
        /*var amout = $(that).val();
        var amount = $('.amount').val();
        console.log("amout"+amout);
        console.log("amount"+amount);
        if(amout > amount){
            alert("请输入正确的退费金额");
        }*/

    }

    /**
     * 审批
     * @param that
     * @constructor
     */
    function Approval(that) {
        var approvalRemark = $("#approvalRemark").val();
        var classHour = $("#classHour").val();
        var amout = $("#amout").val();
        var remark = $("#remark").val();
        //console.log(approvalRemark);
        var refundStatus = $(that).attr("refundStatus");
        //console.log(refundStatus);
        var refundId = $(that).attr("refundId");
        var isDelete = $(that).attr("isDelete");
        //console.log(refundId);
        ajaxRequest("tssMemberReturnPremiumController/saveOrUpdate.do", {
            approvalRemark:approvalRemark,
            refundStatus:refundStatus,
            refundId:refundId,
            classHour:classHour,
            amout:amout,
            remark:remark,
            isDelete:isDelete
        }, function (data) {
            alert("提交成功");
            if (data.resCode == "200") {

            }
        }, function () {
            ajaxError("加载页面失败!")
        }, "post", "json")

    }

</script>
